# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ruby-docopt
_gemname=docopt
pkgver=0.6.1
pkgrel=11
pkgdesc='Command line option parser, that will make you smile'
arch=('any')
url='https://rubygems.org/gems/docopt'
license=('MIT')
depends=('ruby')
conflicts=('ruby-docopt-git')
provides=('ruby-docopt')
source=("https://rubygems.org/downloads/$_gemname-$pkgver.gem")
noextract=("$_gemname-$pkgver.gem")
sha512sums=('9df1f16687cdcf4a119b559ebc41633ffb5440ac4522162e25bc0e04437067aa7f7a41e0c11b6c19bbf67e72f00219a162e1c73dbd418b83317b375029827581')

package() {
  _gemdir="$(ruby -e'puts Gem.default_dir')"

  gem install --ignore-dependencies --no-user-install --no-document \
    -i "$pkgdir/$_gemdir" -n "$pkgdir/usr/bin" $_gemname-$pkgver.gem

  rm "$pkgdir/$_gemdir/cache/$_gemname-$pkgver.gem"
  find "$pkgdir/$_gemdir/extensions/" -name *.so -delete
  rm -r "$pkgdir/$_gemdir/gems/$_gemname-$pkgver/"{test,examples}

  install -Dm 644 "$pkgdir/$_gemdir/gems/$_gemname-$pkgver/LICENSE" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

